import psutil
import socket

def get_host_ip():
    with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:
        s.connect(('8.8.8.8', 80))
        ip = s.getsockname()[0]
        return ip

def get_ip_addresses(family):
    for interface, snics in psutil.net_if_addrs().items():
        for snic in snics:
            if snic.family == family:
                yield (interface, snic.address)

def get_dai_ip():
    for ip in get_ip_addresses(socket.AF_INET):
        if str(ip[1]).startswith('10.'):
            return ip[1]
    return get_host_ip()

if __name__ == "__main__":
    for ip in get_ip_addresses(socket.AF_INET):
        print(f"{ip[0]}: {ip[1]}")
